package com.zxp00.JavaBasics;

import java.util.*;

public class Z01_base {
    /*a++和++a的区别*/
    public static void plus(){
        int a = 1;
        System.out.println("a的地址:"+System.identityHashCode(a));
        System.out.println("a:"+a);

        /*将a的值先赋给b再自增或自减，故b=1,a=2*/
        int b = a++;
        System.out.println("b的地址:"+System.identityHashCode(b));
        System.out.println("a:"+a);
        System.out.println("b:"+b);

        /*先进行自增或自减在将值赋给c*/
        int c = ++a;
        System.out.println("c的地址:"+System.identityHashCode(c));
        System.out.println("a:"+a);
        System.out.println("c:"+c);
    }

    /*打印分隔符*/
    public static void printSign(){
        for (int i = 0; i < 20; i++) {
            System.out.print("=");      //不换行打印
        }
    }

    /*输入、输出*/
    public static void Input_Print(){
        System.out.println("Hello");    // 换行打印
        /*不换行打印*/
        System.out.print("Hello");
        System.out.print("World");
        System.out.println();

        /*输入*/
        Scanner sc =new Scanner(System.in);             // 从键盘接入数据
        int a = sc.nextInt();                           // 输入int型
        System.out.println(a);

        sc.nextLine();
        String b = sc.nextLine();                       // 输入字符串
        System.out.println(b);
    }

    public static void main(String[] args) {
//        plus();
//        printSign();
        Input_Print();
    }
}
